package com.ruoyi.web.controller.saas;

import com.bonuo.saas.domain.ResearchProjectQueryPassword;
import com.bonuo.saas.service.ResearchProjectQueryPasswordService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "网站查询密码")
@RestController
@RequestMapping("/saas/researchProjectQueryPassword")
public class ResearchProjectQueryPasswordController extends BaseController {
    @Autowired
    private ResearchProjectQueryPasswordService researchProjectQueryPasswordService;

    @ApiOperation(value = "查询网站查询密码信息",httpMethod = "GET")
    @GetMapping("/list")
    public TableDataInfo list(ResearchProjectQueryPassword researchProjectQueryPassword, Integer pageNum, Integer pageSize){
        if(pageNum != null && pageSize != null){
            startPage();
        }
        List<ResearchProjectQueryPassword> list = researchProjectQueryPasswordService.selectResearchProjectQueryPasswordList(researchProjectQueryPassword);
        return getDataTable(list);
    }

    @ApiOperation(value = "添加网站查询密码信息",httpMethod = "POST")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody ResearchProjectQueryPassword researchProjectQueryPassword){
        return toAjax(researchProjectQueryPasswordService.insertResearchProjectQueryPassword(researchProjectQueryPassword));
    }

    @ApiOperation(value = "修改网站查询密码信息",httpMethod = "PUT")
    @PutMapping("/update")
    public AjaxResult update(@RequestBody ResearchProjectQueryPassword researchProjectQueryPassword){
        return toAjax(researchProjectQueryPasswordService.updateResearchProjectQueryPassword(researchProjectQueryPassword));
    }

    @ApiOperation(value = "删除网站查询密码信息",httpMethod = "DELETE")
    @DeleteMapping("/delete/{id}")
    public AjaxResult delete(@PathVariable Integer id){
        return toAjax(researchProjectQueryPasswordService.deleteResearchProjectQueryPasswordById(id));
    }

}
